# Linux限定, windows无法使用
from pexpect import pxssh
import sys

ssh = pxssh.pxssh()
# ssh.logfile = sys.stdout              # 本行只适用于py2
ssh.logfile = open('output.txt', 'wb')
hostname = str('39.108.226.252')
username = str('root')
password = str('123qwert/')
ssh.login(hostname, username, password)
ssh.sendline('ls ./')
s.prompt()
print(open('output.txt','r').read())